<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>props-从父组件向子组件传值</title>
    <style>
        .card {
            width: 100px;
            height: 100px;
            background-color: greenyellow;
            margin-left: 10px;
        }
    </style>
</head>
<body>
<!--
    1. 什么是父组件？
    2. 什么叫子组件？
-->
<div id="app">
    <div class="box">
  <!--      <card v-for="employee in employees" :name="employee.name" :age="employee.age"></card>-->
            <card2  v-for="employee in employees" :employee="employee"></card2>
    </div>
</div>
</body>
<script src="../../lib/vue.js"></script>
<script>

    var card = {
        props: ['name', 'age'],
        template: '<div class="item">{{name}}-{{age}}</div>',
        data: function () {
            return {
                title: 'Matt'
            }
        }
    }

    var card2 = {
        props: ['employee'],
        template: '<div class="item">{{employee.name}}-{{employee.age}}</div>',
        data: function () {
            return {
                title: 'Matt'
            }
        }
    }

    new Vue({
        el: '#app',
        components: {
            card,
            card2
        },
        data: {
            employees: [
                {
                    name: 'L',
                    age: 34
                }, {
                    name: 'M',
                    age: 56
                }
            ]
        }
    })


</script>
</html>